/*
This is the Stata code for replicating the results for "Path to Centralization and Development: Evidence from Siam"
by C. Paik and J. Vechbanyongratana. To run the code, you will need to download two data files, path_to_centralization_file1 
(provincial data) and path_to_centralization_file2 (monthon data).
*/

clear

cd "xxxxxxxxx"

use path_to_centralization_file1, clear


***Table 1: Summary Statistics
sum electric_dum_1970 watsup_dum_1970 primary_ed_1970 electric_dum_1980 watsup_dum_1980 primary_ed_1980 ///
	electric_dum_1990 watsup_dum_1990 primary_ed_1990 watsup_dum_2000 primary_ed_2000 ///
	pc_gpp_1973 pc_gpp_1975 pc_gpp_1980 pc_gpp_1985 pc_gpp_1990 pc_gpp_1995 pc_gpp_2000 pc_gpp_2005 pc_gpp_2010 ///
	monthon_year class4 class123 extprov tribstate monthon_frontier ///
	dist2bangkok_100 monthon_hq prov_pop_den_10km_1915 soilsuit elev_mean areakm2_1000 coast_km_100 ///
	industrial_estates_1990 industrial_estates_1995 industrial_estates_2000 industrial_estates_2005 industrial_estates_2010


****Table 2: Determinants of Centralization timing
reg monthon_year tribstate extprov class123 monthon_frontier frontier_ext frontier_class123, r
reg monthon_year tribstate extprov class123 monthon_frontier frontier_ext frontier_class123 prov_pop_den_10km_1915, r
reg monthon_year tribstate extprov class123 monthon_frontier frontier_ext frontier_class123 soilsuit, r
reg monthon_year tribstate extprov class123 monthon_frontier frontier_ext frontier_class123 dist2bangkok, r
reg monthon_year tribstate extprov class123 monthon_frontier frontier_ext frontier_class123 areakm2_1000, r
reg monthon_year tribstate extprov class123 monthon_frontier frontier_ext frontier_class123 elev_mean, r
reg monthon_year tribstate extprov class123 monthon_frontier frontier_ext frontier_class123 coast_km_100, r
reg monthon_year tribstate extprov class123 monthon_frontier frontier_ext frontier_class123 prov_pop_den_10km_1915 soilsuit dist2bangkok areakm2_1000 elev_mean coast_km_100, r

***Table 3: Tests of Mean Differences for Public Good and Infrastructure Measures at the Time of Centralization
*See below

***Table 4: OLS Regressions - Centralization and Public Goods Provision, 1970
reg electric_dum_1970 monthon_year, r
reg electric_dum_1970 monthon_year tribstate extprov class123, r
reg electric_dum_1970 monthon_year tribstate extprov class123 monthon_frontier dist2bangkok_100 monthon_hq, r
reg electric_dum_1970 monthon_year tribstate extprov class123 monthon_frontier dist2bangkok_100 monthon_hq prov_pop_den_10km_1915 soilsuit elev_mean areakm2_1000 coast_km_100, r

reg watsup_dum_1970 monthon_year, r
reg watsup_dum_1970 monthon_year tribstate extprov class123, r
reg watsup_dum_1970 monthon_year tribstate extprov class123 monthon_frontier dist2bangkok_100 monthon_hq, r
reg watsup_dum_1970 monthon_year tribstate extprov class123 monthon_frontier dist2bangkok_100 monthon_hq prov_pop_den_10km_1915 soilsuit elev_mean areakm2_1000   coast_km_100, r

reg primary_ed_1970 monthon_year, r
reg primary_ed_1970 monthon_year tribstate extprov class123, r
reg primary_ed_1970 monthon_year tribstate extprov class123 monthon_frontier dist2bangkok_100 monthon_hq, r
reg primary_ed_1970 monthon_year tribstate extprov class123 monthon_frontier dist2bangkok_100 monthon_hq prov_pop_den_10km_1915 soilsuit elev_mean areakm2_1000 coast_km_100, r


***Table 5: OLS Regressions - Centralization and Public Goods Provision, 1980-2000
reg electric_dum_1980 monthon_year tribstate extprov class123  monthon_frontier prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100, r
reg watsup_dum_1980 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100 , r
reg primary_ed_1980 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100 , r
reg electric_dum_1990 monthon_year tribstate extprov class123  monthon_frontier prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100 industrial_estates_1990, r
reg watsup_dum_1990 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100 industrial_estates_1990, r
reg primary_ed_1990 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100 industrial_estates_1990, r
reg watsup_dum_2000 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100 industrial_estates_2000, r
reg primary_ed_2000 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100 industrial_estates_2000, r


***Table 6: OLS Regressions - Centralization and Gross Provincial Product, 1973
reg lnpc_gpp_1973 monthon_year, r
reg lnpc_gpp_1973 monthon_year tribstate extprov class123, r
reg lnpc_gpp_1973 monthon_year tribstate extprov class123 monthon_frontier dist2bangkok_100 monthon_hq, r
reg lnpc_gpp_1973 monthon_year tribstate extprov class123 monthon_frontier dist2bangkok_100 monthon_hq prov_pop_den_10km_1915 soilsuit elev_mean areakm2_1000   coast_km_100, r


***Table 7: OLS Regressions - Centralization and Gross Provincial Product, 1975-2010
reg lnpc_gpp_1973 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100, r
reg lnpc_gpp_1975 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100, r
reg lnpc_gpp_1980 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100, r
reg lnpc_gpp_1985 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100, r
reg lnpc_gpp_1990 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100 industrial_estates_1990, r
reg lnpc_gpp_1995 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100 industrial_estates_1995, r
reg lnpc_gpp_2000 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100 industrial_estates_2000, r
reg lnpc_gpp_2005 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100 industrial_estates_2005, r
reg lnpc_gpp_2010 monthon_year tribstate extprov class123  monthon_frontier  prov_pop_den_10km_1915 soilsuit dist2bangkok_100 areakm2_1000 elev_mean monthon_hq coast_km_100 industrial_estates_2010, r

*******Appendix Tables

***Appendix Table 1: OLS Regressions - Divergence in Government Provided Public Goods and Infrastructure at the Time of Centralization
*See below

***Appendix Table 2: Centralization Timing and Primary Education Attainment in the 1920-1939 Birth Cohort
reg primary_ed_birthyear_1920_40 monthon_year, r
reg primary_ed_birthyear_1920_40 monthon_year tribstate extprov class123, r
reg primary_ed_birthyear_1920_40 monthon_year tribstate extprov class123 monthon_frontier dist2bangkok_100 monthon_hq, r
reg primary_ed_birthyear_1920_40 monthon_year tribstate extprov class123 monthon_frontier dist2bangkok_100 monthon_hq prov_pop_den_10km_1915 soilsuit elev_mean areakm2_1000 coast_km_100, r




clear

use path_to_centralization_file2

***Table 3: Tests of Mean Differences for Public Good and Infrastructure Measures at the Time of Centralization
estpost sum school_govt_share_1917 teacher_govt_share_1917 if late_monthon==1
matrix means1=e(mean)
matrix list means1

estpost sum school_govt_share_1917 teacher_govt_share_1917 if late_monthon==0
matrix means0=e(mean)
matrix list means0

estpost ttest school_govt_share_1917 teacher_govt_share_1917, by(late_monthon)
estadd matrix means1
estadd matrix means0

esttab, label varwidth(30) nonumber noobs cells("means1(fmt(3)) means0(fmt(3)) b(star fmt(3)) se(fmt(3)) count(fmt(0))") star(* 0.1 ** .05 *** 0.01) ///
	collabels("Mean(late monthon=1)" "Mean(late monthon=0)" "Diff." "Std. Error" "Obs.") ///
	nonote addnote("Notes: *** p<0.01 ** p<0.05 * p<0.1")
	
estpost sum monthon_rr_pre1916 if late_monthon==1
matrix meanr1=e(mean)
matrix list meanr1

estpost sum monthon_rr_pre1916 if late_monthon==0
matrix meanr0=e(mean)
matrix list meanr0

estpost prtest monthon_rr_pre1916, by(late_monthon)
estadd matrix meanr1
estadd matrix meanr0

esttab, label varwidth(30) nonumber noobs cells("meanr1(fmt(3)) meanr0(fmt(3)) b(star fmt(3)) se(fmt(3)) count(fmt(0))") star(* 0.1 ** .05 *** 0.01) ///
	collabels("Mean(late monthon=1)" "Mean(late monthon=0)" "Diff." "Std. Error" "Obs.") ///
	nonote addnote("Notes: *** p<0.01 ** p<0.05 * p<0.1")


***Appendix Table 1: OLS Regressions - Divergence in Government Provided Public Goods and Infrastructure at the Time of Centralization
*Panel A: Centralization Timing and Share of Government Schools in Monthon, 1917
reg school_govt_share_1917 monthon_year, r
reg school_govt_share_1917 monthon_year monthon_frontier, r
reg school_govt_share_1917 monthon_year dist2bangkok, r
reg school_govt_share_1917 monthon_year monthon_pop_dens, r
reg school_govt_share_1917 monthon_year monthon_soilsuit , r
reg school_govt_share_1917 monthon_year monthon_elev, r
reg school_govt_share_1917 monthon_year monthon_area, r
reg school_govt_share_1917 monthon_year monthon_coast_km_100, r

*Panel B: Centralization Timing and Share of Government Teachers in Monthon, 1917
reg teacher_govt_share_1917 monthon_year, r
reg teacher_govt_share_1917 monthon_year monthon_frontier, r
reg teacher_govt_share_1917 monthon_year dist2bangkok, r
reg teacher_govt_share_1917 monthon_year monthon_pop_dens, r
reg teacher_govt_share_1917 monthon_year monthon_soilsuit , r
reg teacher_govt_share_1917 monthon_year monthon_elev, r
reg teacher_govt_share_1917 monthon_year monthon_area, r
reg teacher_govt_share_1917 monthon_year monthon_coast_km_100, r

*Panel C: Centralization Timing and Monthon Railway Construction by 1916
reg monthon_rr_pre1916 monthon_year, r
reg monthon_rr_pre1916 monthon_year monthon_frontier, r
reg monthon_rr_pre1916 monthon_year dist2bangkok, r
reg monthon_rr_pre1916 monthon_year monthon_pop_dens, r
reg monthon_rr_pre1916 monthon_year monthon_soilsuit , r
reg monthon_rr_pre1916 monthon_year monthon_elev, r
reg monthon_rr_pre1916 monthon_year monthon_area, r
reg monthon_rr_pre1916 monthon_year monthon_coast_km_100, r




